home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / util / cdity / ModeProSrc.lha / Prefs / MPPUpdateGads.c < prev    next >
C/C++ Source or Header  |  1998-12-26  |  22KB  |  718 lines

  1. #include "/modepro.h"
  2. #include "mpp.h" 
  3. #include "mppexterns.h"
  4.  
  5.  
  6. UBYTE DepthToSlider[]=
  7. {
  8. //  0,1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 // requested depth
  9. //  0,1,2,3,4,5,6,7,8,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32;
  10.     0,1,2,3,4,5,6,7,8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11
  11. };
  12.  
  13. UBYTE SliderToDepth[]=
  14. {
  15.   0,1,2,3,4,5,6,7,8,16,24,32
  16. };
  17.  
  18. void SetPrefsGadgets(struct DefaultNode *n);
  19.  
  20. void UpdateGadgets(void)
  21. {
  22.   struct DefaultNode *n;
  23.  
  24.   NodeCnt=CountNodes(&MPSem->PromotionList[CurrentList]); 
  25.  
  26.   n=GetActiveNode();
  27.  
  28.   SetDispGadgets(n);
  29.   SetFontGadgets(n);
  30.   SetSharedGadgets(n);
  31.   SetPublicGadgets(n);
  32.   SetHotKeyGadgets(n);
  33.   SetOptionGadgets(n);
  34.   Set3DGadgets(n);
  35.   SetPaletteGadgets(n);
  36.   SetPrefsGadgets(n);
  37.   SetBackdropGadgets(n);
  38.   
  39.   if(ForcedEditMsg)
  40.   {
  41.     STRPTR name, type;
  42.     
  43.     if(n)
  44.     {
  45.       name=n->Def_Node.ln_Name;
  46.       type=ListLabels[ListToCyc[n->Type]];
  47.     }
  48.     else
  49.     {
  50.       name=type=""; 
  51.     }
  52.       
  53.     LG_SetGadgetAttrs(GadControl,GD_FE_ENTRY_NAME,
  54.                       GTTX_Text,    name,
  55.                       TAG_DONE);
  56.     LG_SetGadgetAttrs(GadControl,GD_FE_ENTRY_TYPE,
  57.                       GTTX_Text,    type,
  58.                       TAG_DONE);
  59.     
  60.     /*
  61.     LG_SetGadgetAttrs(GadControl,GD_FE_SCREENNAME_DISP,
  62.                       GTTX_Text,    name,
  63.                       TAG_DONE);
  64.     LG_SetGadgetAttrs(GadControl,GD_FE_PROGRAMNAME_DISP,
  65.                       GTTX_Text,    type,
  66.                       TAG_DONE);
  67.     LG_SetGadgetAttrs(GadControl,GD_FE_SCREENMODE_DISP,
  68.                       GTTX_Text,    name,
  69.                       TAG_DONE);
  70.     LG_SetGadgetAttrs(GadControl,GD_FE_SCREENNAME_DISP,
  71.                       GTTX_Text,    name,
  72.                       TAG_DONE);*/
  73.  
  74.     
  75.   }
  76.   else
  77.   {
  78.     if(n)
  79.     {
  80.       LG_SetGadgetAttrs(GadControl,GD_TYPE,
  81.                       GTCY_Active,    ListToCyc[CurrentList],
  82.                       GA_Disabled,    ForcedEditMsg,
  83.                       TAG_DONE);
  84.       LG_SetGadgetAttrs(GadControl,GD_LIST,
  85.                         GTLV_Labels     ,&MPSem->PromotionList[CurrentList],
  86.                         GTLV_MakeVisible,LVActive,
  87.                         GTLV_Selected   ,LVActive,
  88.                         GA_Disabled,    ForcedEditMsg,
  89.                         TAG_DONE);
  90.       LG_SetGadgetAttrs(GadControl,GD_REMOVE,
  91.                         GA_Disabled,    ForcedEditMsg,
  92.                         TAG_DONE);
  93.       LG_SetGadgetAttrs(GadControl,GD_NAME,
  94.                         GA_Disabled,  ForcedEditMsg,//  n->Type==PL_SCREENMODES,
  95.                         TAG_DONE);
  96.       LG_SetGadgetAttrs(GadControl,GD_SELECT_NAME,
  97.                         GA_Disabled,    ForcedEditMsg,
  98.                         TAG_DONE);
  99.       LG_SetGadgetAttrs(GadControl,GD_MOVE,
  100.                         GTSL_Max,       NodeCnt-1,
  101.                         GTSL_Level,     (NodeCnt-1)-LVActive,
  102.                         GA_Disabled,    ForcedEditMsg,
  103.                         TAG_DONE);
  104.        LG_SetGadgetAttrs(GadControl,GD_NEW,
  105.                         GA_Disabled,    ForcedEditMsg,
  106.                         TAG_DONE);
  107.     }
  108.     else
  109.     {
  110.       LG_SetGadgetAttrs(GadControl,GD_LIST,
  111.                         GTLV_Labels,    NULL,
  112.                         GA_Disabled,    TRUE,
  113.                         TAG_DONE);
  114.       LG_SetGadgetAttrs(GadControl,GD_REMOVE,
  115.                         GA_Disabled,    TRUE,
  116.                         TAG_DONE);
  117.       LG_SetGadgetAttrs(GadControl,GD_NAME,
  118.                         GA_Disabled,    TRUE,
  119.                         TAG_DONE);
  120.       LG_SetGadgetAttrs(GadControl,GD_SELECT_NAME,
  121.                         GA_Disabled,    TRUE,
  122.                         TAG_DONE);
  123.       LG_SetGadgetAttrs(GadControl,GD_MOVE,
  124.                         GTSL_Max,       0,
  125.                         GA_Disabled,    TRUE,
  126.                         TAG_DONE);
  127.       LG_SetGadgetAttrs(GadControl,GD_NEW,
  128.                         GA_Disabled,    0,
  129.                         TAG_DONE);
  130.       LG_SetGadgetAttrs(GadControl,GD_TYPE,
  131.                         GTCY_Active,      ListToCyc[CurrentList],
  132.                         GA_Disabled,      0,
  133.                         TAG_DONE);
  134.       
  135.     }
  136.   }
  137. }
  138.  
  139.  
  140. UBYTE  ModeName[33];
  141.  
  142. /*
  143. void Set_OverscanGadget(struct DefaultNode *n)
  144. {
  145.   LONG otype=1,
  146.        disabled=TRUE;
  147.   
  148.   if(n)
  149.   {
  150.     switch(n->ModeSelect)
  151.     {
  152.       case 2:
  153.       case 3:
  154.         disabled=FALSE;
  155.         break;
  156.     }
  157.     otype=n->OverscanType;
  158.   }
  159.  
  160.   LG_SetGadgetAttrs(GadControl,GD_OVERSCAN,
  161.                     GTCY_Active     ,otype-1,
  162.                     GA_Disabled     ,disabled,
  163.                     TAG_DONE);
  164. }
  165. */
  166.  
  167. void SetDispGadgets(struct DefaultNode *n)
  168. {
  169.   WORD width=0,height=0;
  170.   BOOL d0=TRUE,d1=TRUE,d2=TRUE;
  171.   ULONG ms=0,msoff=0,otype=1;
  172.   
  173.   ModeName[0]=0;
  174.   if(n)
  175.   {
  176.     if(!(n->Flags & DNF_NEVER_PROMOTE))
  177.     {
  178.       d0=FALSE;
  179.       if(n->Type==PL_PUBLICSCREENS)
  180.       {
  181.         n->ModeSelect=max(2,n->ModeSelect);
  182.         msoff=2;
  183.       }
  184.       
  185.       ms=n->ModeSelect;
  186.       otype=n->OverscanType;
  187.       switch(ms)
  188.       {
  189.         case MS_DONT_PROMOTE: /* Program default */
  190.           break;
  191.         case MS_PROMOTE_MONITOR: /* Monitor only */
  192.           d1=FALSE;
  193.           GetMonitorName(n->ModeID,ModeName,32);//                                                     (4.57.6)
  194.           /*{//                                                                                        (4.57.6)
  195.             struct MonitorInfo mi;//                                                                   (4.57.6)
  196.              if(GetDisplayInfoData(NULL,(UBYTE *)&mi,sizeof(struct MonitorInfo),DTAG_MNTR,n->ModeID)>0)//  (4.57.6)
  197.               if(mi.Mspc)//                                                                            (4.57.6)
  198.                 if(mi.Mspc->ms_Node.xln_Name)//                                                        (4.57.6)
  199.                   strncpy(ModeName,mi.Mspc->ms_Node.xln_Name,32);//                                    (4.57.6)
  200.           }*///                                                                                        (4.57.6)
  201.           break;
  202.  
  203.         case MS_PROMOTE_SCREENMODE: /* Screen Name */
  204.         case MS_PROMOTE_REQUESTER:
  205.           d1=d2=FALSE;
  206.           width   =n->Width;
  207.           height  =n->Height;
  208.           {
  209.             STRPTR workname;
  210.             
  211.             if(workname=GetModeName(n->ModeID))
  212.             {
  213.               strncpy(ModeName,workname,32);
  214.               FreeVec(workname);
  215.             }
  216.             else
  217.             {
  218.               ModeName[0]=0;
  219.             }
  220.           }
  221.           break;
  222.  
  223.         case MS_PROMOTE_BEST_MODE:  //                                                                 (4.57.11)
  224.           d1=d2=FALSE;//                                                                               (4.57.11)
  225.           width   =n->Width;//                                                                         (4.57.11)
  226.           height  =n->Height;//                                                                        (4.57.11)
  227.           GetMonitorName(n->ModeID,ModeName,32);//                                                     (4.57.11)
  228.           break;//                                                                                     (4.57.11)
  229.         
  230.         default:
  231.           strcpy(ModeName,MiscText[UNKNOWN_PROMOTION_MODE]);
  232.           break;
  233.       } 
  234.       ModeName[32]=0;
  235.     }
  236.   }
  237.   
  238.   LG_SetGadgetAttrs(GadControl,GD_SCREENMODE,
  239.                     GTTX_Text       ,ModeName,
  240.                     GA_Disabled     ,d0,
  241.                     TAG_DONE);
  242.                     
  243.   LG_SetGadgetAttrs(GadControl,GD_MODESEL,
  244.                     GTCY_Active     ,ms-msoff,
  245.                     GTCY_Labels     ,&ModeSelLabels[msoff], 
  246.                     GA_Disabled     ,d0,
  247.                     TAG_DONE);
  248.   LG_SetGadgetAttrs(GadControl,GD_SELMODE,
  249.                     GA_Disabled     ,d1,
  250.                     TAG_DONE);
  251.                     /*
  252.   LG_SetGadgetAttrs(GadControl,GD_ENABLE_W_H,
  253.                     GTCB_Checked    ,(!(n->Flags & DNF_IGNORE_WH) && !d2),
  254.                     GA_Disabled     ,d2,
  255.                     TAG_DONE);
  256.                     */
  257.   LG_SetGadgetAttrs(GadControl,GD_WIDTH,
  258.                     GTIN_Number     ,width,
  259.                     GA_Disabled     ,d2,
  260.                     TAG_DONE);
  261.   LG_SetGadgetAttrs(GadControl,GD_HEIGHT,
  262.                     GTIN_Number     ,height,
  263.                     GA_Disabled     ,d2,
  264.                     TAG_DONE);
  265.   LG_SetGadgetAttrs(GadControl,GD_OVERSCAN,
  266.                     GTCY_Active     ,otype-1,
  267.                     GA_Disabled     ,d2,
  268.                     TAG_DONE);
  269.   SetPaletteGadgets(n);
  270. }
  271.  
  272. void SetFontGadgets(struct DefaultNode *n)
  273. {
  274.   ULONG d1=1,disable=~0,
  275.         type=0,
  276.         fasp=0;
  277.   
  278.   if(n)
  279.   {
  280.     if(!(n->Flags & DNF_NEVER_PROMOTE))
  281.     {
  282.       d1=0;
  283.       type=n->FontType;
  284.   
  285.       if(type==SFONT_MP)
  286.         disable=0;
  287.  
  288.       if(!disable)
  289.       {
  290.         fasp=n->Flags & FIXASPECT;
  291.       }
  292.     }
  293.   }
  294.         
  295.   LG_SetGadgetAttrs(GadControl,GD_SFONT,
  296.                      GTCY_Active,   type,
  297.                      GA_Disabled,   d1,
  298.                      TAG_DONE);
  299.   LG_SetGadgetAttrs(GadControl,GD_PICKFONT,
  300.                      GA_Disabled,   disable,
  301.                      TAG_DONE);
  302.   WriteFontDisp(n);
  303.  
  304.   LG_SetGadgetAttrs(GadControl,GD_FASPECT,
  305.                      GTCB_Checked,  fasp,                 
  306.                      GA_Disabled,   disable,
  307.                      TAG_DONE);
  308. }
  309.  
  310. void SetSharedGadgets(struct DefaultNode *n )
  311. {
  312.   BOOL share=FALSE,d1=TRUE;
  313.   UBYTE *str=NULL;
  314.   
  315.   if(n && V39)
  316.   {
  317.     if(!(n->Flags & DNF_NEVER_PROMOTE))
  318.     {
  319.       d1=FALSE;
  320.       if(n->Flags & SHAREPENS)
  321.       {
  322.         share = TRUE;
  323.         str=n->LockedPens;
  324.       }
  325.     }
  326.   }
  327.         
  328.   LG_SetGadgetAttrs(GadControl,GD_SHAREPENS,
  329.                     GTCB_Checked  ,share, 
  330.                     GA_Disabled   ,d1,
  331.                     TAG_DONE); 
  332.   LG_SetGadgetAttrs(GadControl,GD_LOCKEDPENS,
  333.                     GTST_String   ,str, 
  334.                     GA_Disabled   ,!(share),
  335.                     TAG_DONE);
  336. }
  337.  
  338.  
  339.  
  340. void SetPublicGadgets(struct DefaultNode *n)
  341. {
  342.   BOOL  pub  =FALSE,
  343.         d1   =TRUE;
  344.   UBYTE *pubname=0; 
  345.         
  346.   if(n)
  347.   {
  348.     if((n->Type!=PL_PUBLICSCREENS) && !(n->Flags & DNF_NEVER_PROMOTE))
  349.     {
  350.       d1=FALSE;
  351.       if(n->PubOptions)
  352.       {
  353.         pub=TRUE;
  354.         pubname=n->PubName;
  355.       }
  356.     }
  357.   }
  358.       
  359.  
  360.   LG_SetGadgetAttrs(GadControl,GD_PUBOPT,
  361.                     GTCB_Checked,   pub,
  362.                     GA_Disabled,    d1,
  363.                     TAG_DONE);
  364.   LG_SetGadgetAttrs(GadControl,GD_PUBNAME,
  365.                     GTST_String,    pubname,
  366.                     GA_Disabled,    !pub,
  367.                     TAG_DONE); 
  368. }
  369.  
  370.  
  371. void SetHotKeyGadgets(struct DefaultNode *n )
  372. {
  373.   BOOL hk=FALSE,d1=TRUE;
  374.   UBYTE *str=NULL;
  375.   
  376.   if(n)
  377.   {
  378.     if(!(n->Flags & DNF_NEVER_PROMOTE))
  379.     {
  380.       d1=FALSE;
  381.       if(n->Flags & SCRHOTKEY)
  382.       {
  383.         hk = TRUE;
  384.         str=n->HotKey;
  385.       }
  386.     }
  387.   }
  388.         
  389.   LG_SetGadgetAttrs(GadControl,GD_HOTKEYOPT,
  390.                     GTCB_Checked  ,hk, 
  391.                     GA_Disabled   ,d1,
  392.                     TAG_DONE); 
  393.   LG_SetGadgetAttrs(GadControl,GD_HOTKEYSTR,
  394.                     GTST_String   ,str, 
  395.                     GA_Disabled   ,!(hk),
  396.                     TAG_DONE);
  397. }
  398.  
  399. void SetPaletteGadgets(struct DefaultNode *n)
  400. {
  401.   ULONG d1=TRUE,d2=TRUE;
  402.   
  403.   if(n)
  404.   {
  405.     if( ( n->ModeSelect==MS_PROMOTE_SCREENMODE    || 
  406.           n->ModeSelect==MS_PROMOTE_REQUESTER     ||
  407.           n->ModeSelect==MS_PROMOTE_BEST_MODE)    && 
  408.         !(n->Flags & DNF_NEVER_PROMOTE))
  409.     {
  410.       d1=FALSE;
  411.       if(n->Flags & DNF_PALETTE)
  412.         d2=FALSE;
  413.     }
  414.   } 
  415.  
  416.   LG_SetGadgetAttrs(GadControl,GD_PALETTE,
  417.                     GTCB_Checked    ,!d2,
  418.                     GA_Disabled     ,d1,
  419.                     TAG_DONE);
  420.   LG_SetGadgetAttrs(GadControl,GD_EDITPALETTE,
  421.                     GA_Disabled     ,d2,
  422.                     TAG_DONE);
  423.                     
  424.   SetDepthGadgets(n);
  425. }
  426.  
  427.  
  428. void SetDepthGadgets(struct DefaultNode *n)
  429. {
  430.   ULONG   maxdepth    =1,
  431.           depth       =0;
  432.   BOOL    disslide    =TRUE;
  433.   BOOL    discheck    =TRUE,
  434.           checked     =FALSE;
  435.   
  436.   struct  DimensionInfo di;
  437.   
  438.   if(n)
  439.   {
  440.     if(!(n->Flags & DNF_NEVER_PROMOTE))
  441.     {
  442.       n->Depth=max(1,n->Depth);
  443.       if( n->ModeSelect==MS_PROMOTE_SCREENMODE  || 
  444.           n->ModeSelect==MS_PROMOTE_REQUESTER)
  445. //          n->ModeSelect==MS_PROMOTE_BEST_MODE)//                                                     (4.58.1)
  446.       {
  447.         discheck=FALSE;
  448.         if(n->Flags & (DEPTH | DNF_PALETTE))
  449.         {
  450.           disslide = FALSE;
  451.           if(GetDisplayInfoData(NULL,(UBYTE *)&di,sizeof(di),DTAG_DIMS,n->ModeID)>0)//                 (4.57.1)
  452.           {//                                                                                          (4.57.1)
  453.             maxdepth=min(di.MaxDepth,32);// Can only handle upto 32bit                                 (4.57.1)//  (4.57.17)
  454.           }//                                                                                          (4.57.1)
  455.           else//                                                                                       (4.57.1)
  456.           {//                                                                                          (4.57.1)
  457.             maxdepth=32;//                                                                             (4.57.1)//  (4.57.18)
  458.           }//                                                                                          (4.57.1)
  459.           n->Depth=min(n->Depth,maxdepth);//                                                           (4.57.1)
  460.           //                                                                                           (4.57.1)
  461.           checked=n->Flags & DEPTH;
  462.         }                     
  463.       }
  464.       
  465.       if(n->ModeSelect==MS_PROMOTE_BEST_MODE)//                                                        (4.57.15)
  466.       {//                                                                                              (4.57.15)
  467.         discheck=FALSE;//                                                                              (4.57.15)
  468.         if(n->Flags & (DEPTH | DNF_PALETTE))//                                                         (4.57.15)
  469.         {//                                                                                            (4.57.15)
  470.           disslide  = FALSE;//                                                                         (4.57.15)
  471.           maxdepth  = 32;//                                                                            (4.57.15)
  472.           n->Depth  = min(n->Depth,maxdepth);//                                                        (4.57.15)
  473.           checked   = n->Flags & DEPTH;//                                                              (4.57.15)
  474.         }                     //                                                                       (4.57.15)
  475.       }//                                                                                              (4.57.15)
  476.       
  477.       maxdepth=DepthToSlider[maxdepth];//                                                              (4.57.19)
  478.       depth=DepthToSlider[n->Depth];//                                                                 (4.57.19)
  479.     }
  480.   } 
  481.  
  482.   WriteColorDisp(n);
  483.  
  484.   LG_SetGadgetAttrs(GadControl,GD_DODEPTH,
  485.                     GTCB_Checked    ,checked,
  486.                     GA_Disabled     ,discheck,
  487.                     TAG_DONE);
  488.   LG_SetGadgetAttrs(GadControl,GD_DEPTH,
  489.                     GTSL_Max        ,maxdepth,
  490.                     GTSL_Level      ,depth,
  491.                     GA_Disabled     ,disslide,
  492.                     TAG_DONE);
  493. }
  494.  
  495. void SetOptionGadgets(struct DefaultNode *n)
  496. {
  497.   BOOL d1=TRUE,d2=TRUE,as=0,center=0,ilbm=0,planar=0,behind=0,blankb=0;
  498.   
  499.   if(n)
  500.   {
  501.     if(!(n->Flags & DNF_NEVER_PROMOTE))
  502.     {
  503.       d1    =FALSE;
  504.       as    =n->AutoScroll;
  505.       center=n->CenterFlags;
  506.       blankb=n->Flags & DNF_BLANK_BORDER;
  507.       behind=n->Flags & DNF_BEHIND;
  508.       if(V39)
  509.       {
  510.         d2    =FALSE;
  511.         ilbm  =n->Flags & INTERLEAVE;
  512.         planar=n->Flags & DNF_FORCEPLANAR;
  513.       }
  514.     }
  515.   }
  516.  
  517.   LG_SetGadgetAttrs(GadControl,GD_AUTOSCROLL,
  518.                     GTCB_Checked,   as,
  519.                     GA_Disabled,    d1,
  520.                     TAG_DONE);
  521.   LG_SetGadgetAttrs(GadControl,GD_CENTER,
  522.                     GTCY_Active,   center,
  523.                     GA_Disabled,    d1,
  524.                     TAG_DONE);
  525.   LG_SetGadgetAttrs(GadControl,GD_INTERLEAVE,
  526.                     GTCB_Checked,   ilbm,
  527.                     GA_Disabled,    d2,
  528.                     TAG_DONE);
  529.   LG_SetGadgetAttrs(GadControl,GD_FORCE_PLANAR,
  530.                     GTCB_Checked,   planar,
  531.                     GA_Disabled,    d2,
  532.                     TAG_DONE);
  533.   LG_SetGadgetAttrs(GadControl,GD_BEHIND,
  534.                     GTCB_Checked,   behind,
  535.                     GA_Disabled,    d1,
  536.                     TAG_DONE);
  537.   LG_SetGadgetAttrs(GadControl,GD_BLANK_BORDER,
  538.                     GTCB_Checked,   blankb,
  539.                     GA_Disabled,    d1,
  540.                     TAG_DONE);  
  541. }
  542.  
  543. void Set3DGadgets(struct DefaultNode *n)
  544. {
  545.   BOOL look3d=FALSE,d1=TRUE,d2=TRUE,default3d=0,setpens=0;
  546.  
  547.   if(n)
  548.   {
  549.     if(!(n->Flags & DNF_NEVER_PROMOTE))
  550.     {
  551.       d1=FALSE;
  552.       if(look3d=n->Look3D)
  553.       {
  554.         d2=FALSE;
  555.         if(n->Flags & DNF_3D_DEFAULT)
  556.         {
  557.           default3d=1;
  558.         }
  559.         else
  560.           setpens=1;
  561.       }
  562.     }
  563.   }
  564.  
  565.   if(setpens)
  566.     SetPenValues(n->Pens);
  567.   else
  568.     SetPenValues(NULL);
  569.  
  570.   LG_SetGadgetAttrs(GadControl,GD_LOOK3D,
  571.                     GTCB_Checked,   look3d,
  572.                     GA_Disabled,    d1,
  573.                     TAG_DONE);
  574.  
  575.   LG_SetGadgetAttrs(GadControl,GD_3D_DEFAULT,
  576.                     GTCB_Checked,   default3d,
  577.                     GA_Disabled,    d2,
  578.                     TAG_DONE);
  579. }
  580.  
  581.  
  582. void SetPrefsGadgets(struct DefaultNode *n)
  583. {
  584.   /*
  585.   LG_SetGadgetAttrs(GadControl,GD_CANCEL,
  586.                     GA_Disabled,   ForcedEdit,
  587.                     TAG_DONE);
  588.   LG_SetGadgetAttrs(GadControl,GD_USE,
  589.                     GA_Disabled,   ForcedEdit,
  590.                     TAG_DONE);
  591.   LG_SetGadgetAttrs(GadControl,GD_SAVE,
  592.                     GA_Disabled,   ForcedEdit,
  593.                     TAG_DONE);
  594.                     */
  595.  
  596. }
  597.  
  598. void SetPenValues(WORD *pens)
  599. {
  600.   ULONG pen,maxlenpng;
  601.  
  602.  
  603.   LG_SetGadgetAttrs(GadControl,GD_PENLIST,
  604.                     GTLV_Labels,~0,TAG_DONE);  
  605.   if(pens)
  606.   {
  607.     for(pen=0;pen<NumDriPens;pen++)
  608.     {
  609.       stci_d(&PenNames[pen][PenNameLength[pen]],pens[pen]);
  610.     }
  611.     
  612.     LG_SetGadgetAttrs(GadControl,GD_PENVAL,
  613.                          GA_Disabled  ,FALSE,
  614.                          GTIN_Number  ,pens[ActivePen],
  615.                          TAG_DONE);
  616.     LG_SetGadgetAttrs(GadControl,GD_RESETPENS,
  617.                          GA_Disabled  ,FALSE,
  618.                          TAG_DONE);
  619.   }
  620.   else
  621.   {
  622.     for(pen=0;pen<NumDriPens;pen++)
  623.     {
  624.       PenNames[pen][PenNameLength[pen]]=0;
  625.     }
  626.     LG_SetGadgetAttrs(GadControl,GD_PENVAL,
  627.                          GA_Disabled  ,TRUE,
  628.                          TAG_DONE);
  629.     LG_SetGadgetAttrs(GadControl,GD_RESETPENS,
  630.                          GA_Disabled  ,TRUE,
  631.                          TAG_DONE);
  632.  
  633.   }
  634.   LG_SetGadgetAttrs(GadControl,GD_PENLIST,
  635.                          GTLV_Labels      ,&PenList,
  636.                          GTLV_MakeVisible ,ActivePen,
  637.                          GTLV_Selected    ,ActivePen,
  638.                          GA_Disabled      ,!pens,
  639.                          TAG_DONE);
  640.   //LG_SetGadgetAttrs(GadControl,GD_PENNAME,
  641.   //                       GTTX_Text,NULL,TAG_DONE);
  642.   
  643.   
  644.   maxlenpng=min(31,PenNameLength[ActivePen]);
  645.   strncpy(PenNameGad,PenNames[ActivePen],maxlenpng);
  646.   PenNameGad[maxlenpng]=0;
  647.   //LG_SetGadgetAttrs(GadControl,GD_PENNAME,
  648.   //                       GTTX_Text,PenNameGad,TAG_DONE);
  649.   WritePenNameDisp(PenNameGad);
  650. }    
  651.  
  652.  
  653.  
  654. void SetBackdropGadgets(struct DefaultNode *n )
  655. {
  656.   BOOL d1=TRUE;
  657.   UBYTE *str=NULL;
  658.   LONG backdroptype=0;
  659.   
  660.   if(n && V39)
  661.   {
  662.     n->BackdropType=max(n->BackdropType,0);
  663.     n->BackdropType=min(n->BackdropType,2);
  664.  
  665.     if(!(n->Flags & DNF_NEVER_PROMOTE))
  666.     {
  667.       d1=0;
  668.       backdroptype=n->BackdropType;
  669.     }
  670.   }
  671.  
  672.  
  673.   
  674.   LG_SetGadgetAttrs(GadControl,GD_BACKDROPOPT,
  675.               GTCY_Active,    backdroptype, 
  676.               GA_Disabled,    d1, 
  677.               TAG_DONE); 
  678.  
  679.  
  680.   {
  681.     LONG l;
  682.     
  683.     for(l=0;l<3;l++)
  684.       LG_RemoveGadgets(BackdropControl[l]);
  685.   }
  686.  
  687.   LG_AddGadgets(Win,BackdropControl[backdroptype]);
  688.   
  689.   switch(backdroptype)
  690.   {
  691.     case 1:
  692.       str=n->BackdropFile;
  693.       if(str)
  694.         str=FilePart(str);
  695.           
  696.       LG_SetGadgetAttrs(GadControl,GD_BACKDROPFILENAME,
  697.                     GTTX_Text   , str, 
  698.                     TAG_DONE);
  699.       LG_SetGadgetAttrs(GadControl,GD_BACKDROPPICK,
  700.                     TAG_DONE);
  701.       LG_SetGadgetAttrs(GadControl,GD_BACKDROPCENTER,
  702.                     GTCB_Checked  ,n->BackdropFlags & BF_CENTER, 
  703.                     TAG_DONE); 
  704.       break;
  705.     case 2:
  706.       if(V39 && (BackdropPen>=0))
  707.       {
  708.         SetRGB32(&Scr->ViewPort,BackdropPen,
  709.               n->BackdropRGB.Red,
  710.               n->BackdropRGB.Green,
  711.               n->BackdropRGB.Blue);
  712.       }
  713.       break;
  714.   }
  715. }
  716.  
  717. // 6 11 16 39 40 49
  718.